"""
URL configuration for myAED01 project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path

from app01 import views
# from app01.views import ChatView
from app01.views import MyAPI
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path("admin/", admin.site.urls),
    # path('chat/', ChatView.as_view(), name='chat'),
    # path('index/', views.index),  # 设置根路径为 index 视图

    # 用户部分
    # AED地图部分
    # 获取aed设备列表信息
    path('api/get_aed_list/', views.get_aed_list, name='get_aed_list'),
    path('api/search_aed/', views.search_aed, name='search_aed'),

    path('api/my-endpoint/', MyAPI.as_view(), name='my-api-endpoint'), # 设置API-url

    path('kecheng/', views.gotoTest),
    path('users/', views.user_list, name='user_list'),

    # Tool用户问答接口
    # 获取问题列表
    path('api/questions/', views.QuestionList.as_view(), name='question-list'),
    # 发布新问题
    path('api/questions/create/', views.QuestionCreate.as_view(), name='question-create'),
    # 获取回答列表
    path('api/answers/', views.AnswerList.as_view(), name='answer-list'),
    # 发布新回答
    path('api/answers/create/', views.AnswerCreate.as_view(), name='answer-create'),
    # 获取csrf_token
    path('api/get-csrf-token/', views.getToken, name='get-csrf-token'),
    # 获取标签tag
    path('api/tags/', views.TagList.as_view(), name='tag-list'),
    # 回答点赞
    path('api/answers/<int:answer_id>/like/', views.LikeAnswer.as_view(), name='like-answer'),

    # 调用讯飞星火api实现ai问答助手
    path('ask/', views.ask_question, name='ask_question'),

    # 用户登录
    path('api/login/', views.login, name='user_login'),
    # 检查用户登录状态
    path('api/checkLoginStatus/', views.checkLoginStatus, name='checkLoginStatus'),
    path('api/updateProfile/', views.updateProfile, name='updateProfile'),


    # 普通管理员部分——————
    path('map/aed_list/', views.aed_list_view, name='aed_list'),
    # 编辑设备信息
    path('admin_aed-list/', views.admin_aed_list, name='admin_aed_list'),


] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
